package com.hou.utils;

import org.springframework.stereotype.Component;

import java.util.*;

/**
 * @author shkstart
 * @create 2021-09-15-12:07
 */
@Component
public class CreateData {
    final int INDEX_NUM = 25;

    public Object CreateDate(){
        int[] ran = new int[25];
        int[] randoms = createRandom(ran);
        return randoms;
    }

    public int[] createRandom(int arr[]){
        Random random = new Random();

        for (int i = 0; i < INDEX_NUM;) {
            int randoms = random.nextInt(25) + 1;
            if (SameNum(arr,randoms)){
                arr[i] = randoms;
                i++;
            }
        }
        return arr;
    }

    public Boolean SameNum(int arr[],int num){

        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == num){
                return false;
            }
        }
        return true;
    }

    public int[] createIndex(int index[]){
        for (int i = 0; i < 25; i++){
            index[i] = i + 1;
        }
        return index;
    }


}
